﻿{% extends "base.html" %}

{% block scripts %}
{% endblock %}

{% block content %}
    <h1>Партнеры</h1>

    <!--
    <ul class="tabs_list friends_tabs">
        <li class="item item_current"><a href="/companies/">Все Компании</a><span class="bg"></span></li>
        <li class="item"><a href="/online_companies/">Компании онлайн</a><span class="bg"></span></li>
        <li class="item"><a href="/add_company/">Добавить компанию</a><span class="bg"></span></li>
    </ul>
    -->

    <ul class="paging">
                    {% if companies.has_previous %}
					<li><a href="/companies/{{ companies.previous_page_number }}/"><img class="icon" src="/media/images/icon_arrow_2.gif" width="11" height="5"></a></li>
					{% endif %}

                    {% for page in companies.paginator.page_range %}
                        {% if page == companies.number %}
                            <li class="item item_current">{{ page }}</li>
                        {% else %}
                            <li class="item"> <a href="/companies/{{ page }}/">{{ page }}</a></li>
                        {% endif %}
                    {% endfor %}

                    {% if companies.has_next %}
					<li><a href="/companies/{{ companies.next_page_number }}/"><img class="icon" src="/media/images/icon_arrow_1.gif" width="11" height="5"></a></li>
					{% endif %}
	</ul>

    <ul class="info_list_1 friends_list">
        {% for company in companies.object_list %}
        <li class="list_item {% if forloop.first %}list_item_first{% endif %}">
            <img class="pic"
                 {% if company.logo %}
                    src="{{ company.logo.url }}"
                    {% if company.logo.width > company.logo.height %} width="79" {% else %} height="79" {% endif %}
                 {% else %}
                    src="/media/images/img_no.gif" width="79" height="79"
                 {% endif %}
             />
            <div class="item_base">
                <dl class="info">
                    <dt>Компания:</dt>
                    <dd><a href="/company/{{ company.id }}/">{{ company.name }}</a></dd>
                </dl>
            </div>
            <ul class="options">
                {% if request.user in company.clients.all %}
                    <li class="item"><a href="/delete_from_company/{{ company.id }}/">Удалить</a></li>
                {% else %}
                    <li class="item"><a href="/add_to_companies/{{ company.id }}/">Добавить</a></li>
                {% endif %}
                    <li class="item"><a href="/dialog/{{ company.owner.username }}/">Сообщение</a></li>
            </ul>
        </li>
        {% endfor %}

    </ul>

    <ul class="paging">
                    {% if companies.has_previous %}
					<li><a href="/companies/{{ companies.previous_page_number }}/"><img class="icon" src="/media/images/icon_arrow_2.gif" width="11" height="5"></a></li>
					{% endif %}

                    {% for page in companies.paginator.page_range %}
                        {% if page == companies.number %}
                            <li class="item item_current">{{ page }}</li>
                        {% else %}
                            <li class="item"> <a href="/companies/{{ page }}/">{{ page }}</a></li>
                        {% endif %}
                    {% endfor %}

                    {% if companies.has_next %}
					<li><a href="/companies/{{ companies.next_page_number }}/"><img class="icon" src="/media/images/icon_arrow_1.gif" width="11" height="5"></a></li>
					{% endif %}
	</ul>
{% endblock %}